home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
td187src.lzh
/
MAGICDOS.D
< prev
next >
Wrap
Text File
|
1991-06-08
|
9KB
|
266 lines
(*######################################################################
MAGIC Modula's All purpose GEM Interface Cadre
¯ ¯ ¯ ¯ ¯
########################################################################
DOS Disk Operating System Interface for Modula-2
########################################################################
V2.00 17.10.90 Peter Hellinger Anpassung an neues MagicSys
V1.03 01.09.90 Peter Hellinger Bug in DTA gefixed
V1.01 18.06.90 Peter Hellinger Auf Vorschlag von Thomas Tempelmann
wurden die Pterm-Funktionen abgeändert.
V1.00 (C) by Peter Hellinger
######################################################################*)
DEFINITION MODULE MagicDOS;
FROM SYSTEM IMPORT ADDRESS;
FROM MagicSys IMPORT Nil, Null,
Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6, Bit7,
Bit8, Bit9, Bit10, Bit11, Bit12, Bit13, Bit14, Bit15,
LOC, Byte, ByteSet, sWORD, sINTEGER, sCARDINAL, sBITSET,
lWORD, lINTEGER, lCARDINAL, lBITSET;
CONST EOK = 0;
Error = -1;
EDrvNR = -2; (* Drive not ready *)
EUnCmd = -3; (* Unknown command *)
ECRC = -4; (* CRC error *)
EBadRq = -5; (* Bad request *)
ESeek = -6; (* Seek error *)
EMedia = -7; (* Unknown media *)
ESecNF = -8; (* Sector not found *)
EPaper = -9; (* No paper *)
EWritF = -10; (* Write fault *)
EReadF = -11; (* Read fault *)
EGenrl = -12; (* General error *)
EWrPro = -13; (* Write protect *)
EChng = -14; (* Media change *)
EUnDev = -15; (* Unknown device *)
EBadSF = -16; (* Bad sectors on format *)
EOther = -17; (* Insert other disk *)
EInvFN = -32; (* Invalid function number *)
EFilNF = -33; (* File not found *)
EPthNF = -34; (* Path not found *)
ENHndl = -35; (* No handles left *)
EAccDn = -36; (* Access denied *)
EIHndl = -37; (* Invalid handle *)
ENSMem = -39; (* Insufficient memory *)
EIMBA = -40; (* Invalid memory block address *)
EDrive = -46; (* Invaild drive specified *)
ENMFil = -49; (* No more files *)
ERange = -64; (* Range error *)
EIntrn = -65; (* Internal error *)
EPLFmt = -66; (* Invalid program load format *)
EGSBF = -67; (* Setblock failure due to growth restr *)
PROCEDURE Pterm0;
TYPE tChar = RECORD
CASE : sCARDINAL OF
0: long: lCARDINAL;|
1: hi: sCARDINAL;
lo: sCARDINAL;|
2: kbshift: CHAR;
reserved: CHAR;
scan: CHAR;
char: CHAR;|
END;
END;
(* Zum einfachen "auseinandernehmen" des Longwerts, den Cconin liefert.
* Um die gültigen kbshift-Bits zu bekommen, muß das Bit 3 in der System-
* variablen conterm gesetzt sein.
*)
PROCEDURE Cconin (): lCARDINAL;
(* Die meisten Bindings liefern hier ein CHAR, was einer Unterschlagung
* gleichkommt.
*)
PROCEDURE Cconout (ch: CHAR);
PROCEDURE Cauxin (): sCARDINAL;
(* Liefert nach Profibuch tatsächlich ein WORD. Wozu das allerdings gut
* sein soll...
*)
PROCEDURE Cauxout (ch: CHAR);
PROCEDURE Cprnout (ch: CHAR);
CONST Input = 377C;
PROCEDURE Crawio (ch: CHAR): lCARDINAL;
PROCEDURE Crawin (): lCARDINAL;
PROCEDURE Cnecin (): lCARDINAL;
PROCEDURE Cconws (string: ARRAY OF CHAR);
PROCEDURE Cconrs (VAR string: ARRAY OF CHAR);
PROCEDURE Cconis (): BOOLEAN;
PROCEDURE Dsetdrv (drive: sCARDINAL; VAR DriveMap: lBITSET);
PROCEDURE Cconos (): BOOLEAN;
PROCEDURE Cprnos (): BOOLEAN;
PROCEDURE Cauxis (): BOOLEAN;
PROCEDURE Cauxos (): BOOLEAN;
PROCEDURE Dgetdrv (): sCARDINAL;
TYPE PtrDTA = POINTER TO DTA;
DTA = RECORD
dReserved: ARRAY [0..20] OF Byte; (* 1.02 *)
dAttrib: Byte;
dTime: sCARDINAL;
dDate: sCARDINAL;
dLength: lCARDINAL;
dFname: ARRAY [0..13] OF CHAR;
END;
PROCEDURE Fsetdta (dtaptr: ADDRESS);
PROCEDURE Super (VAR stack: ADDRESS);
PROCEDURE Tgetdate (): sCARDINAL;
PROCEDURE Tsetdate (date: sCARDINAL);
PROCEDURE Tgettime (): sCARDINAL;
PROCEDURE Tsettime (time: sCARDINAL);
PROCEDURE Fgetdta (): ADDRESS;
PROCEDURE Sversion (): sCARDINAL;
PROCEDURE Ptermres (keep: lCARDINAL; return: sCARDINAL);
TYPE DISKINFO = RECORD
bFree: lCARDINAL;
bTotal: lCARDINAL;
bSecsiz: lCARDINAL;
bClsiz: lCARDINAL;
END;
PROCEDURE Dfree (VAR dib: ARRAY OF LOC; drive: sCARDINAL);
PROCEDURE Dcreate (pfad: ARRAY OF CHAR): sINTEGER;
PROCEDURE Ddelete (pfad: ARRAY OF CHAR): sINTEGER;
PROCEDURE Dsetpath (pfad: ARRAY OF CHAR): sINTEGER;
CONST ReadOnly = Bit0;
Hidden = Bit1;
System = Bit2;
Volume = Bit3;
Folder = Bit4;
Archive = Bit5;
PROCEDURE Fcreate (name: ARRAY OF CHAR; attr: sBITSET): sINTEGER;
(* Ordner erzeugen NUR mit Dcreate !!! *)
CONST NamePRN = 'PRN:';
NameAUX = 'AUX:';
NameCON = 'CON:';
CONST Read = 0; (* Modus *)
Write = 1;
ReadWrite = 2;
CONST StdIn = 0; (* Keyboard *)
StdOut = 1; (* Console *)
Serial = 2; (* RS232 *)
Printer = 3; (* Centronics *)
PROCEDURE Fopen (name: ARRAY OF CHAR; mode: sCARDINAL): sINTEGER;
PROCEDURE Fclose (handle: sINTEGER): sINTEGER;
PROCEDURE Fread (handle: sINTEGER; VAR count: lCARDINAL; buffer: ADDRESS);
PROCEDURE Fwrite (handle: sINTEGER; VAR count: lCARDINAL; buffer: ADDRESS);
PROCEDURE Fdelete (name: ARRAY OF CHAR): BOOLEAN;
CONST SeekStart = 0; (* Seekmodus *)
SeekPos = 1;
SeekEnd = 2;
PROCEDURE Fseek (offset: lINTEGER; handle, mode: sINTEGER): lCARDINAL;
PROCEDURE Fattrib (name: ARRAY OF CHAR; set: BOOLEAN; VAR attr: sBITSET);
PROCEDURE Fdup (handle: sINTEGER): sINTEGER;
PROCEDURE Fforce (std, nonstd: sINTEGER): BOOLEAN;
PROCEDURE Dgetpath (VAR pfad: ARRAY OF CHAR; drive: sCARDINAL);
CONST Minus1 = 0FFFFFFFFH;
PROCEDURE Malloc (bytes: lCARDINAL): ADDRESS;
PROCEDURE Mfree (addr: ADDRESS): BOOLEAN;
PROCEDURE Mshrink (addr: ADDRESS; newSize: lCARDINAL): BOOLEAN;
CONST LoadnGo = 0;
Load = 3;
Run = 4;
NewPD = 5;
PROCEDURE Pexec (mode: sCARDINAL; VAR name, tail, env: ARRAY OF CHAR): sINTEGER;
PROCEDURE Pterm (code: sINTEGER);
PROCEDURE Fsfirst (name: ARRAY OF CHAR; attr: sBITSET): sINTEGER;
PROCEDURE Fsnext (): sINTEGER;
PROCEDURE Frename (VAR curr, new: ARRAY OF CHAR): sINTEGER;
TYPE DOSTIME = RECORD
time: sCARDINAL;
date: sCARDINAL;
END;
PROCEDURE Fdatime (handle: sINTEGER; VAR dostime: ARRAY OF LOC; set: BOOLEAN);
(*====================================================================*)
(* Folgende Funktionen sind erst auf TT-Rechnern verfügbar! *)
(* Funktion ohne Gewähr 8-) *)
(*====================================================================*)
CONST STRAM = 0;
FASTRAM = 1;
STRAMpref = 2;
FAS